/* GUI CONVERTED from xxnrmsite.p (converter v1.75) Fri Apr 13 12:22:46 2001 */
/* xxnrmsite.p -                                                          */
/* $Revision: 1.7.1.8 $                                                   */
/*V8:ConvertMode=Maintenance                                              */
/* REVISION: 9.1      LAST MODIFIED: 30/10/03   BY: *CLI* cli             */

/* DISPLAY TITLE */
{mfdtitle.i "b+ "}

define variable del-yn like mfc_logical initial no.


/* Variable added to perform delete during CIM.
 * Record is deleted only when the value of this variable
 * Is set to "X" */
define variable batchdelete as character format "x(1)" no-undo.

/* DISPLAY SELECTION FORM */

/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1 COLUMN 3 NO-LABEL VIEW-AS TEXT SIZE-PIXELS 1 BY 1
 SKIP(.1)  /*GUI*/
   nrs_site     colon 25
   si_desc        AT 48 NO-LABEL SKIP(1)
   nrs_prnbr     COLON 25 nrs_sqnbr     COLON 55 skip
   nrs_ponbr     COLON 25 nrs_sonbr     COLON 55 skip
   nrs_rcnbr     COLON 25 nrs_invnbr    COLON 55 skip
   nrs_rtnbr     COLON 25 nrs_shnbr     COLON 55 skip
   nrs_iqcnbr    COLON 25 nrs_crsnbr    COLON 55 skip
   nrs_wonbr    COLON 25 nrs_tranbr    COLON 55 skip
   nrs_iunbr    COLON 25 nrs_runbr    COLON 55 skip
   
    SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER INITIAL "".
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:HIDDEN in frame a = yes.
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5.  /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

/* DISPLAY */
view frame a.
mainloop:
repeat with frame a:
/*GUI*/ if global-beam-me-up then undo, leave.


   /* Initialize delete flag before each display of frame */
   batchdelete = "".

   /* Prompt for the delete variable in the key frame at the
   * End of the key field/s only when batchrun is set to yes */
   prompt-for nrs_site
              batchdelete no-label when (batchrun)
   editing:
      /* FIND NEXT/PREVIOUS RECORD */
      
      if frame-field = "nrs_site" then do:
         /* FIND NEXT/PREVIOUS RECORD */
          {mfnp.i nrs_mstr nrs_site nrs_site nrs_site nrs_site
           nrs_site}
      end.
      if recno <> ? then do:                                                  
         display nrs_site 
         nrs_prnbr                 
         nrs_ponbr                            
         nrs_sqnbr                                               
         nrs_sonbr                                      
         nrs_invnbr
         nrs_rcnbr  
         nrs_rtnbr  
         nrs_iqcnbr 
         nrs_shnbr  
         nrs_crsnbr
         nrs_wonbr
         nrs_tranbr
         nrs_iunbr
         nrs_runbr . 
                                                                         
         find si_mstr where input nrs_site = si_site no-lock no-error.      
         display si_desc when (available si_mstr).                            
      end. /* if recno <> ? then do: */                                      
   end. /* editing: */

   /* ADD/MOD/DELETE  */
   find first nrs_mstr where nrs_site = input nrs_site no-error.
   if not available nrs_mstr then do:
      display "" @ nrs_prnbr  
              "" @ nrs_ponbr   
              "" @ nrs_sqnbr   
              "" @ nrs_sonbr   
              "" @ nrs_invnbr
              "" @ nrs_rcnbr  
              "" @ nrs_rtnbr  
              "" @ nrs_iqcnbr 
              "" @ nrs_shnbr  
              "" @ nrs_crsnbr
              "" @ nrs_wonbr
              "" @ nrs_tranbr
              "" @ nrs_iunbr
              "" @ nrs_runbr
      with frame a. 
      {pxmsg.i &MSGNUM=1 &ERRORLEVEL=1}
      create nrs_mstr.
      assign nrs_site. 
   end. /* if not available nrs_mstr then do: */
                          
   /* STORE MODIFY DATE AND USERID */
   nrs_mod_date = today.
   nrs_userid = global_userid.
  
   find si_mstr where si_site = input frame a nrs_site
      no-lock no-error.
   if not available si_mstr then do: 
       {pxmsg.i &MSGNUM=708 &ERRORLEVEL=3}
        next-prompt nrs_site with frame a.
        undo mainloop, retry.
   end. 
  
         display nrs_site 
         nrs_prnbr                 
         nrs_ponbr                            
         nrs_sqnbr                                               
         nrs_sonbr                                      
         nrs_invnbr
         nrs_rcnbr  
         nrs_rtnbr  
         nrs_iqcnbr 
         nrs_shnbr  
         nrs_crsnbr 
         nrs_wonbr
         nrs_tranbr
         nrs_iunbr
         nrs_runbr .

   find si_mstr where si_site = nrs_site no-lock no-error.
      display si_desc when (available si_mstr).
   recno = recid(nrs_mstr).

   ststatus = stline[2].
   status input ststatus.
   del-yn = no.

   nrs_fm:
   do on error undo, retry:
/*GUI*/if global-beam-me-up then undo, leave.
     set nrs_prnbr    
         nrs_ponbr    
         nrs_rcnbr    
         nrs_rtnbr    
         nrs_iqcnbr   
         nrs_sqnbr    
         nrs_sonbr    
         nrs_invnbr   
         nrs_shnbr    
         nrs_crsnbr
         nrs_wonbr
         nrs_tranbr
         nrs_iunbr
         nrs_runbr 
     go-on("F5" "CTRL-D").
     if input nrs_prnbr <> "" then do: 
        find nr_mstr where input nrs_prnbr = nr_seqid no-lock no-error. 
        if not available nr_mstr then do:                                      
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_prnbr.                                      
           display "" @ nrs_prnbr.                           
           undo, retry nrs_fm.
        end.                       
     end.
    
     if input nrs_ponbr <> "" then do:                              
        find nr_mstr where input nrs_ponbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_ponbr.                                     
           display "" @ nrs_ponbr.
           undo, retry nrs_fm.
        end.                                                            
     end.
    
     if input nrs_sqnbr <> "" then do:                                                        
        find nr_mstr where input nrs_sqnbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                      
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_sqnbr.                                     
           display "" @ nrs_sqnbr.                         
           undo, retry nrs_fm.
        end.           
     end.

     if input nrs_sonbr <> "" then do:                                                             
        find nr_mstr where input nrs_sonbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                      
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_sonbr.                                     
           display "" @ nrs_sonbr.                         
          undo, retry nrs_fm.
        end.                                                            
     end.

     if input nrs_invnbr <> "" then do:                                                             
        find nr_mstr where input nrs_invnbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_invnbr.                                     
           display "" @ nrs_invnbr.                         
           undo, retry nrs_fm.
        end.
     end.
     
     if input nrs_shnbr <> "" then do:                                                             
        find nr_mstr where input nrs_shnbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_shnbr.                                     
           display "" @ nrs_shnbr.                         
           undo, retry nrs_fm.
        end.
     end.

     if input nrs_iqcnbr <> "" then do:                                                             
        find nr_mstr where input nrs_iqcnbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_iqcnbr.                                     
           display "" @ nrs_iqcnbr.                         
           undo, retry nrs_fm.
        end.
     end.

     if input nrs_rtnbr <> "" then do:                                                             
        find nr_mstr where input nrs_rtnbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_rtnbr.                                     
           display "" @ nrs_rtnbr.                         
           undo, retry nrs_fm.
        end.
     end.

     if input nrs_rcnbr <> "" then do:                                                             
        find nr_mstr where input nrs_rcnbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_rcnbr.                                     
           display "" @ nrs_rcnbr.                         
           undo, retry nrs_fm.
        end.
     end.

     if input nrs_crsnbr <> "" then do:                                                             
        find nr_mstr where input nrs_crsnbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_crsnbr.                                     
           display "" @ nrs_crsnbr.                         
           undo, retry nrs_fm.
        end.
     end.
     
     if input nrs_wonbr <> "" then do:                                                             
        find nr_mstr where input nrs_wonbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_wonbr.                                     
           display "" @ nrs_wonbr.                         
           undo, retry nrs_fm.
        end.
     end.

     if input nrs_tranbr <> "" then do:                                                             
        find nr_mstr where input nrs_tranbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_tranbr.                                     
           display "" @ nrs_tranbr.                         
           undo, retry nrs_fm.
        end.
     end.

     if input nrs_iunbr <> "" then do:                                                             
        find nr_mstr where input nrs_iunbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_iunbr.                                     
           display "" @ nrs_iunbr.                         
           undo, retry nrs_fm.
        end.
     end.

     if input nrs_runbr <> "" then do:                                                             
        find nr_mstr where input nrs_runbr = nr_seqid no-lock no-error.
        if not available nr_mstr then do:                                     
          {pxmsg.i &MSGNUM=2914 &ERRORLEVEL=3}
           next-prompt nrs_runbr.                                     
           display "" @ nrs_runbr.                         
           undo, retry nrs_fm.
        end.
     end.

  /* DELETE */
     /* Delete to be executed if batchdelete is set or
     * F5 or CTRL-D pressed */
     if lastkey = keycode("F5") or lastkey = keycode("CTRL-D")
        or input batchdelete = "x":U
     then do:
        del-yn = yes.
        {mfmsg01.i 11 1 del-yn}
        if not del-yn then undo nrs_fm.
        delete nrs_mstr.
        clear frame a.
/*GUI*/ RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
        del-yn = no.
        next mainloop.
     end. /* lastkey = keycode("F5") */
   end.   /* do on error undo, retry: */
/*GUI*/ if global-beam-me-up then undo, leave.
end.      /* repeat with frame a: */
/*GUI*/ if global-beam-me-up then undo, leave.
status input.
